package com.mccrea.pattern.facade;

/**
 * @Classname HomeTheaterFacade
 * @Description 家庭影院外观类
 * @Date 2021/5/11 0011 15:37
 * @Created by Mccrea_Gao
 */
public class HomeTheaterFacade {

    private DVDPlayer dvdPlayer;

    private Popcorn popcorn;

    private Projector projector;

    private Screen screen;

    private Stereo stereo;

    private TheaterLight theaterLight;

    public HomeTheaterFacade() {
        this.dvdPlayer = DVDPlayer.getInstance();
        this.popcorn = Popcorn.getInstance();
        this.projector = Projector.getInstance();
        this.screen = Screen.getInstance();
        this.stereo = Stereo.getInstance();
        this.theaterLight = TheaterLight.getInstance();
    }

    // 准备工作
    public void ready() {
        popcorn.on();
        popcorn.poping();
        screen.down();
        projector.on();
        stereo.on();
        dvdPlayer.on();
        theaterLight.dim();
    }

    // 播放
    public void play() {
        dvdPlayer.play();
    }

    // 暂停
    public void pause() {
        dvdPlayer.pause();
    }

    public void end() {
        popcorn.off();
        theaterLight.bright();
        screen.up();
        projector.off();
        stereo.off();
        dvdPlayer.off();
    }

}
